Imports System.Drawing
Imports OpenArchive.Document.Components.Data

Namespace OpenArchive
    Namespace Document
        Namespace Components
            Public Class ColdComponent
                Inherits Component
                Private Const c_ComponentName As String = "Cold"
                Private m_Version As New Version(1, 0)

                Friend Sub New(ByVal Pages() As String)
                    Initialize()
                    Content = New ColdContent(Pages, Nothing)
                End Sub
                Friend Sub New(ByVal Pages() As String, ByVal ColdView As Guid)
                    Initialize()
                    Content = New ColdContent(Pages, ColdView)
                End Sub
                'Friend Sub New(ByVal ColdcomponentDatafromDatabase As Data.ColdComponentData)
                '	If m_Version.CompareTo(ColdcomponentDatafromDatabase.Version) < 0 Then
                '		Throw New VersionconflictException()
                '	End If
                '	DataObjects = ColdcomponentDatafromDatabase
                'End Sub
                Private Sub Initialize()
                    MyBase.SetComponentName(c_ComponentName)
                    DataObjects = New Data.ColdComponentData()
                    Version = m_Version
                End Sub
                Public Shadows Property Content() As ColdContent
                    Get
                        Return TryCast(MyBase.Content, ColdContent)
                    End Get
                    Set(ByVal value As ColdContent)
                        MyBase.Content = value
                    End Set
                End Property

                Public ReadOnly Property Image() As Image
                    Get
                        Throw New NotImplementedException()
                        'Return Nothing
                        ' Return a multipage Image created by text and ColdViewsettings 
                    End Get
                End Property
                Public ReadOnly Property ColdViewSettings() As Settings.ColdViewSettings
                    Get
                        Throw New NotImplementedException()
                        ' Find the Coldviewsettings by ColdViewGuid in the global archivesettings and return them
                    End Get
                End Property
                Public Property Pages() As String()
                    Get
                        Return TryCast(TryCast(DataObjects, Data.ColdComponentData).Content, ColdContent).Pages
                    End Get
                    Set(ByVal value As String())
                        TryCast(TryCast(DataObjects, Data.ColdComponentData).Content, ColdContent).Pages = value
                    End Set
                End Property
                Public Property ColdView() As Guid
                    Get
                        Return TryCast(TryCast(DataObjects, Data.ColdComponentData).Content, ColdContent).ColdView
                    End Get
                    Set(ByVal value As Guid)
                        TryCast(TryCast(DataObjects, Data.ColdComponentData).Content, ColdContent).ColdView = value
                    End Set
                End Property
                Friend Overrides Function IsResponsible(ByVal ComponentDataType As Global.System.Type, ByVal Version As Version) As Object
                    Return Type.Equals(ComponentDataType, New Components.Data.ColdComponentData().GetType())
                End Function
                Public Overrides ReadOnly Property IsSingleInstanceType() As Boolean
                    Get
                        Return True
                    End Get
                End Property
            End Class
        End Namespace
    End Namespace
End Namespace